package com.chinasoft.utils;

import java.util.Random;

public class SaltUtils {

    /**
     * 生成随机salt的静态方法
     * @param n
     * @return
     */
    public static String getSalt(int n){
        char[] chars = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()".toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            char aChar = chars[new Random().nextInt(chars.length)];
            sb.append(aChar);
        }
        return sb.toString();
    }


//    public static void main(String[] args) {
//        String str = "123456123456";
//        Md5Hash md5Hash = new Md5Hash("123456", "123456", 1024);
//        System.out.println(md5Hash.toHex());
//    }
}
